#!/usr/bin/env python
import itk
import sys
from optparse import OptionParser
import os
import subprocess
import imageTools.ITKUtils.io as io
import imageTools.ITKUtils.ifilter as ifilter
import glob
from . import lungSeg
from . import seg_after_filter
from . import utils

def runFilter(filename, var, mode):
    outputfile = "m_" + str(mode) + "s_" + str(var) + ".mha" 
    cmd = "HessianEigenImages" + " -i "+ filename  + " -s " + str(var) + " -m " + str(mode)\
                                    +" -o " + outputfile 
    print cmd
    os.system("pwd")
    if (os.path.exists(outputfile) == False):
        os.system(cmd)
        print "Filtering successfully. Now run the segmentation...."
    else:
        print outputfile ,"already exists"
    return outputfile



